/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Tools;

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;

/**
 *
 * @author ARMGARCES
 */
public class Datos {
    /**
     * @return the cont_login
     */
    public static String[] getLocalHost() {        
        InetAddress ip;
        try {
            ip = InetAddress.getLocalHost();
            NetworkInterface network = NetworkInterface.getByInetAddress(ip);
            byte[] sb = network.getHardwareAddress();

            StringBuilder mac = new StringBuilder();
            for (int i = 0; i < sb.length; i++) {
                    mac.append(String.format("%02X%s", sb[i], (i < sb.length - 1) ? "-" : ""));		
            }
            return new String[] {ip.getHostName(), ip.getHostAddress(), mac.toString()};
            
        } catch (UnknownHostException | SocketException e) {
            Tools.getErrorMessage(e.getStackTrace(), e.getMessage());
 	}
        return null;
    }

}
